package com.shali.cloud.feign;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.shali.cloud.entity.User;

@FeignClient("microservice-provider-user")
public interface UserFeignClient {

	//俩坑：1-GetMapping不支持，2-PathVariable得设置值
	@RequestMapping(value = "/findOne/{id}",method = RequestMethod.GET)
	public User findById(@PathVariable("id") Long id);
	
	@RequestMapping(value = "/user",method = RequestMethod.POST)
	public User user(@RequestBody User user);
	//请求不成功，，只要参数是复杂对象，即使指定了是Get请求，feign依然以Post请求方式发送
	@RequestMapping(value = "/get-user",method = RequestMethod.GET)
	public User getUser(@RequestBody User user);
}
